package main;

import java.awt.*;


public class Player1 extends LivingEntity {

    public Player1(Image left, Image stepLeft, Image right, Image stepRight, Image stay) {
        super(left, stepLeft, right, stepRight, stay, 0, 0);
    }
    @Override
    public void update() {
        super.update();
        int stepx = 0;
        int stepy = 0;

        if (Game.VK_A) {
            stepx--;
        }
        if (Game.VK_D) {
            stepx++;
        }
        if (Game.VK_W) {
            stepy--;
        }
        if (Game.VK_S) {
            stepy++;
        }
        turn = stepx == 0 ? Integer.compare(stepy, 0) : Integer.compare(stepx, 0);


        if(moveIsTrue(stepx * 2, stepy * 2)) {
            posX += stepx * 2;
            posY += stepy * 2;
        } else if (moveIsTrue(stepx, stepy)) {
            posX += stepx;
            posY += stepy;
        }
    }

}
